package com.wodan.zhongjinjicang.frame;

//import org.apache.commons.lang.time.DateUtils;
//import org.jsoup.helper.StringUtil;
//import org.apache.commons.lang.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.util.Assert;

/*import com.wodan.platform.foundation.enums.BusinessErrorEnum;
import com.wodan.platform.foundation.exception.BusinessException;
import com.wodan.platform.foundation.util.CalendarUtil;
import com.wodan.platform.foundation.util.Coder;
import com.wodan.platform.foundation.util.DateFormatUtils;
import com.wodan.shijianke.cache.account.AccountBeanCache;
import com.wodan.shijianke.cache.accountmoney.AccountMoneyBeanCache;
import com.wodan.shijianke.cache.admin.AdminUserBeanCache;
import com.wodan.shijianke.cache.applyjob.JobIdResumeIdCache;
import com.wodan.shijianke.cache.enterprise.EnterpriseBeanCache;
import com.wodan.shijianke.cache.job.ParttimeJobBeanCache;
import com.wodan.shijianke.cache.resume.ResumeBeanCache;
import com.wodan.shijianke.entity.AccountBean;
import com.wodan.shijianke.entity.ApplyJobBean;
import com.wodan.shijianke.entity.EnterpriseBasicInfoBean;
import com.wodan.shijianke.entity.ParttimeJobBean;
import com.wodan.shijianke.entity.ResumeBean;
import com.wodan.shijianke.entity.mgr.UserInfoBean;
import com.wodan.shijianke.enums.AccountStatusEnum;
import com.wodan.shijianke.enums.AccountTypeEnum;
import com.wodan.shijianke.enums.SalaryUnitEnum;
import com.wodan.shijianke.enums.UserInfoRankEnum;
import com.wodan.shijianke.enums.UserSessionKeyEnum;
import com.wodan.shijianke.enums.UserTypeEnum;
import com.wodan.shijianke.foundation.bd.RecruitmentServiceHelper;
import com.wodan.shijianke.foundation.clientapi.CalendarHelper;
import com.wodan.shijianke.foundation.clientapi.EnumFieldValueChecker;
import com.wodan.shijianke.foundation.payment.PaymentConfigService;
import com.wodan.shijianke.foundation.session.CommonSessionInterface;
import com.wodan.shijianke.foundation.session.UserSessionRedisCache;
import com.wodan.shijianke.rds.dao.read.EnterpriseBasicInfoReadDAO;
import com.wodan.shijianke.rds.dao.read.ResumeReadDAO;*/

/**
 * Json业务处理的公共基类
 *
 * @author Administrator
 * @ClassName: AbstractClientApiJsonBusinessMethodService
 * @date 2015-1-16 上午11:07:43
 * @history
 */
public abstract class AbstractClientApiJsonBusinessMethodService extends JsonBusinessMethodServiceTemplate {

    private static Logger logger = LoggerFactory.getLogger(AbstractClientApiJsonBusinessMethodService.class);


//    protected abstract void checkEnumFields(JSONObject content);


    /*private static final String[] CAN_OPTION_MONEY_ACCOUNT_IN_UPDATE_PHONE = new String[]{"13799372584",
            "13124003129", "18606067872", "18950254524", "18059051792", "18859179352"}; // 升级期间可以进行账户操作的
    // 手机号

    *//**
     * session缓存
     *//*
    @Autowired
    @Qualifier("shijianke_user_session")
    protected UserSessionRedisCache userSessionCache;

    *//**
     * 枚举字段校验器
     *//*
    @Autowired
    private EnumFieldValueChecker enumFieldValueChecker;

    @Autowired
    private EnterpriseBasicInfoReadDAO enterpriseBasicInfoReadDAO;

    @Autowired
    private ParttimeJobBeanCache parttimeJobBeanCache;

    @Autowired
    private ResumeBeanCache resumeBeanCache;

    @Autowired
    private EnterpriseBeanCache enterpriseBeanCache;

    @Autowired
    private JobIdResumeIdCache jobIdResumeIdCache;

    @Autowired
    private AccountBeanCache accountBeanCache;

    @Autowired
    private PaymentConfigService paymentConfigService;

    @Autowired
    private ResumeReadDAO resumeReadDAO;

    @Autowired
    private RecruitmentServiceHelper recruitmentServiceHelper;

    @Autowired
    private AccountMoneyBeanCache accountMoneyBeanCache;

    @Autowired
    private AdminUserBeanCache adminUserBeanCache;

    @Override
    protected void doDerivedClassPublicCheck(String clientIp, JSONObject content) {
        if (isNeedLogin(content)) {
            // 如果需要登录，那么要判断账号是否冻结
            AccountStatusEnum accountStatus = accountBeanCache.getAccountStatusById(this.getCurrentAccountId());
            // 判断用户状态是否正常
            if (AccountStatusEnum.FREEZE.equals(accountStatus)) { // 用户被冻结
                int resultId = BusinessErrorEnum.ERROR_USER_IS_FREEZE.getCode();
                String resultDesc = BusinessErrorEnum.ERROR_USER_IS_FREEZE.getDesc();
                throw new BusinessException(resultId, resultDesc, false);
            }
        }

        // 进行枚举字段校验，如果不符合要求，直接抛出异常
        checkEnumFields(content);

        // 进行url字段格式校验
        if (isNeedCheckUrlFieldFormat(content)) {
            checkUrlFieldFormat(content);
        }

        // 接口是否需要参与 交易对账
        if (isNeedAccountVerify(content)) {

            // 接口是否允许账户交易操作
            if (!paymentConfigService.isEnableAccountMoneyOption()) {
                String currLoginPhone = getCurrentPhoneNum();
                int canOption = 0;
                for (String telephone : CAN_OPTION_MONEY_ACCOUNT_IN_UPDATE_PHONE) {
                    if (telephone.equals(currLoginPhone)) {
                        canOption = 1;
                    }
                }
                if (canOption == 0) {
                    throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "系统正在出账，请稍候再试", false);
                }
            }

            *//**
             * 判断当前是否在对账时间内 若是适逢每月1号，则从0点开始
             *//*
            Date currTime = new Date();
            long beginTime = 0;
            Integer dayOfMonth = CalendarUtil.getDayNumOfMonth(currTime);
            if (dayOfMonth == 1) {
                beginTime = CalendarUtil.getTodayBeginTime().getTime();
            } else {
                beginTime = CalendarHelper.getVerifyAccountBeginTime().getTime();
            }
            long endTime = CalendarHelper.getVerifyAccountEndTime().getTime();
            if (currTime.getTime() >= beginTime && currTime.getTime() <= endTime) {
                throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "系统正在出账，请稍候再试", false);
            }

        }

        // 校验客户端上传的时间
        if (isNeedCheckClientTime(content)) {

            Long clientTimeMillSeconds = userSessionCache.getLong(UserSessionKeyEnum.CLIENT_TIME_MILLSECODS);
            if (clientTimeMillSeconds != null) {
                Long client_time_millseconds = content.getLong("client_time_millseconds");
                if (clientTimeMillSeconds > client_time_millseconds) {
                    throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "请求不合法", false);
                }
            }
        }

        // 校验是否可以进行第三方账户充值和转账
        if (isCheckThirdPlatRechargeWithdraw(content)) {
            if (!paymentConfigService.isEnableThirdplatRechargeWithdraw()) {
                throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前环境为开发或测试环境，不允许进行微信/支付宝充值和提现", false);
            }
        }

        if (isCheckAcctEncptPassword(content)) {
            final String ACCT_ENCPT_PASSWORD = "acct_encpt_password"; // 申请ID
            final String CLIENT_TIME_MILLSECONDS = "client_time_millseconds";

            checkPayPassword(content.getString(ACCT_ENCPT_PASSWORD), content.getLong(CLIENT_TIME_MILLSECONDS));
        }
    }


    *//**
     * 是否需要检测url校验
     *
     * @param content
     * @return
     * @Description:
     *//*
    protected boolean isNeedCheckUrlFieldFormat(JSONObject content) {
        return true;
    }


    protected boolean isCheckAcctEncptPassword(JSONObject content) {
        return false;
    }

    protected boolean isCheckThirdPlatRechargeWithdraw(JSONObject content) {
        return false;
    }

    @Override
    protected CommonSessionInterface getCommonSessionInterface() {
        return userSessionCache;
    }

    *//**
     * 接口是否需要参与 交易对账
     *//*
    protected boolean isNeedAccountVerify(JSONObject content) {
        return false;
    }

    *//**
     * 是否需要校验客户端 上传的时间
     *//*
    protected boolean isNeedCheckClientTime(JSONObject content) {
        return false;
    }

    *//**
     * 校验枚举字段
     *//*
    protected abstract void checkEnumFields(JSONObject content);

    *//**
     * @return
     * @Description: 根据sessionId判断用户是否登录
     *//*
    protected boolean isLogin() {
        return userSessionCache.isLogin();
    }

    *//**
     * 根据sessionId获取AccountId
     *
     * @return
     * @Description:
     *//*
    protected Long getCurrentAccountId() {
        return userSessionCache.getAccountId();
    }

    protected AccountTypeEnum getCurrentAccountType() {
        return userSessionCache.getAccountType();
    }

    protected String getCurrentPhoneNum() {
        return userSessionCache.getString(UserSessionKeyEnum.PHONE_NUM);
    }

    *//**
     * 获取当前登录用户账户信息
     *
     * @return
     *//*
    protected AccountBean getAccountBean(Long accountId) {
        return accountBeanCache.getBeanById(accountId);
    }

    *//**
     * 获取当前登录用户账户信息
     *
     * @return
     *//*
    protected String getTrueNameByAccountId(Long accountId) {
        AccountBean account = accountBeanCache.getBeanById(accountId);
        if (account != null) {
            return account.getTrueName();
        } else {
            return null;
        }
    }

    *//**
     * 开放UserSessionRedisCache
     *
     * @return
     * @Description:
     *//*
    protected UserSessionRedisCache getUserSessionCache() {
        return userSessionCache;
    }

    *//**
     * 根据sessionId查询简历id
     *
     * @return
     * @Description:
     *//*
    protected Long getCurrentResumeId() {
        Long accountId = getCurrentAccountId();
        Long resumeId = resumeReadDAO.selectIdByAccountId(accountId);
        if (resumeId == null) {
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前账号没有对应简历信息, accountId=" + accountId);
        }
        return resumeId;
    }

    *//**
     * 获取当前简历信息
     *
     * @return
     * @Description:
     *//*
    protected ResumeBean getCurrentResume() {
        Long currentResumeId = this.getCurrentResumeId();
        return resumeBeanCache.getBeanById(currentResumeId);
    }

    *//**
     * 根据账号id查询简历id
     *
     * @param accountId
     * @return
     * @Description:
     *//*
    protected Long getResumeIdByAccountId(Long accountId) {
        Assert.notNull(accountId);

        Long resumeId = resumeReadDAO.selectIdByAccountId(accountId);
        if (resumeId == null) {
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前账号没有对应简历信息, accountId=" + accountId);
        }

        return resumeId;
    }

    *//**
     * 根据sessionId查询企业Id
     *
     * @return
     * @Description:
     *//*
    protected Long getCurrentEnterpriseId() {
        Long accountId = getCurrentAccountId();
        if (accountId == null) {
            return null;
        }

        Long entId = enterpriseBasicInfoReadDAO.selectIdByAccountId(accountId);
        if (entId == null) {
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前账号没有对应企业信息, accountId=" + accountId);
        }
        return entId;
    }

    *//**
     * 查询当前登录的企业信息
     *
     * @return
     * @Description:
     *//*
    protected EnterpriseBasicInfoBean getCurrentEnterpriseInfo() {
        Long currentEnterpriseId = this.getCurrentEnterpriseId();
        return enterpriseBeanCache.getBeanById(currentEnterpriseId);
    }

    *//**
     * 根据企业id查询企业信息
     *
     * @return
     * @Description:
     *//*
    protected Long getEnterpriseInfoIdByAccountId(Long accountId) {
        Long enterpriseId = enterpriseBasicInfoReadDAO.selectIdByAccountId(accountId);
        if (enterpriseId == null) {
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前账号没有对应企业信息, accountId=" + accountId);
        }
        return enterpriseId;
    }

    *//**
     * 根据简历id查询账号id
     *
     * @param resumeId
     * @return
     * @Description:
     *//*
    protected Long getAccountIdByResumeId(Long resumeId) {
        Long accountId = resumeBeanCache.getAccountIdByResumeId(resumeId);
        if (accountId == null) {
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前简历没有对应账号信息, resumeId=" + resumeId);
        }
        return accountId;
    }

    *//**
     * 根据企业id查询账号id
     *
     * @param enterpriseId
     * @return
     * @Description:
     *//*
    protected Long getAccountIdByEnterpriseId(Long enterpriseId) {
        Long accountId = enterpriseBeanCache.getAccountIdByEnterpriseId(enterpriseId);
        if (accountId == null) {
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "当前企业没有对应账号信息, enterpriseId=" + enterpriseId);
        }
        return accountId;
    }

    *//**
     * 校验cityId
     *
     * @param cityId
     * @Description:
     *//*
    protected void checkCityId(Long cityId) {
        if (cityId == null) {
            return;
        }

        if (cityId.equals(0L)) { // 城市ID不能为0
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), "城市ID不能为0");
        }

        enumFieldValueChecker.checkCityId(cityId);
    }

    *//**
     * 校验岗位分类
     *
     * @param jobClassifyId
     * @Description:
     *//*
    protected void checkJobClassifyId(Long jobClassifyId) {
        if (jobClassifyId == null) {
            return;
        }

        enumFieldValueChecker.checkJobClassifyId(jobClassifyId);
    }

    *//**
     * 校验区域id
     *
     * @param addressAreaId
     * @Description:
     *//*
    protected void checkAddressAreaId(Long addressAreaId) {
        if (addressAreaId == null) {
            return;
        }

        enumFieldValueChecker.checkAddressAreaId(addressAreaId);

    }

    *//**
     * 校验用户类型是否合法
     *
     * @param accountType
     * @Description:
     *//*
    protected void checkAccountType(Integer accountType) {
        if (accountType == null) {
            return;
        }

        enumFieldValueChecker.checkAccountType(accountType);
    }

    *//**
     * 校验optType
     *
     * @param optType
     * @Description:
     *//*
    protected void checkOptType(Integer optType) {
        if (optType == null) {
            return;
        }

        enumFieldValueChecker.checkOptType(optType);
    }

    *//**
     * 校验第三方平台id
     *
     * @param thridPlatID
     * @Description:
     *//*
    protected void checkThirdPlatId(Long thridPlatID) {
        if (thridPlatID == null) {
            return;
        }

        enumFieldValueChecker.checkThirdPlatId(thridPlatID);
    }

    *//**
     * 校验企业雇佣状态
     *
     * @param entEmployStatus
     * @Description:
     *//*
    protected void checkEntEmployStauts(Integer entEmployStatus) {
        if (entEmployStatus == null) {
            return;
        }

        enumFieldValueChecker.checkEntEmployStauts(entEmployStatus);

    }

    *//**
     * 校验学生同意状态
     *
     * @param stu_agree_status
     * @Description:
     *//*
    protected void checkStuAgreeStatus(Integer stuAgreeStatus) {
        if (stuAgreeStatus == null) {
            return;
        }

        enumFieldValueChecker.checkStuAgreeStatus(stuAgreeStatus);

    }

    *//**
     * 校验评价状态
     *
     * @param stu_evalu_status
     * @Description:
     *//*
    protected void checkEvaluStatus(Integer stEvaluStatus) {
        if (stEvaluStatus == null) {
            return;
        }

        enumFieldValueChecker.checkEvaluStatus(stEvaluStatus);

    }

    *//**
     * 校验广告位编号
     *
     * @param ad_site_id
     * @Description:
     *//*
    protected void checkAdvertisementSiteId(Long adSiteId) {
        if (adSiteId == null) {
            return;
        }

        enumFieldValueChecker.checkAdvertisementSiteId(adSiteId);

    }

    *//**
     * 校验产品类型
     *
     * @param product_type
     * @Description:
     *//*
    protected void checkProductType(Integer productType) {
        if (productType == null) {
            return;
        }

        enumFieldValueChecker.checkProductType(productType);
    }

    *//**
     * 校验岗位状态
     *
     * @param job_status
     * @Description:
     *//*
    protected void checkJobStatus(Integer jobStatus) {
        if (jobStatus == null) {
            return;
        }

        enumFieldValueChecker.checkJobStatus(jobStatus);

    }

    *//**
     * 校验反馈类型
     *
     * @param feedback_type
     * @Description:
     *//*
    protected void checkFeedBackType(Integer feedbackType) {
        if (feedbackType == null) {
            return;
        }

        enumFieldValueChecker.checkFeedBackType(feedbackType);
    }

    *//**
     * 校验客户端类型
     *
     * @param accessClientType
     * @Description:
     *//*
    protected void checkAccessClientTypeEnum(Integer accessClientType) {
        if (accessClientType == null) {
            return;
        }

        enumFieldValueChecker.checkAccessClientTypeEnum(accessClientType);

    }

    *//**
     * 校验topic id
     *
     * @param topicId
     * @Description:
     *//*
    protected void checkJobTopicId(Long topicId) {
        if (topicId == null) {
            return;
        }

        enumFieldValueChecker.checkJobTopicId(topicId);
    }

    *//**
     * 校验学校id
     *
     * @param schoolId
     * @Description:
     *//*
    protected void checkSchoolId(Long schoolId) {
        if (schoolId == null) {
            return;
        }

        enumFieldValueChecker.checkSchoolId(schoolId);

    }

    *//**
     * 校验性别
     *
     * @param sex
     * @Description:
     *//*
    protected void checkSex(Integer sex) {
        if (sex == null) {
            return;
        }

        enumFieldValueChecker.checkSex(sex);

    }

    *//**
     * 校验学生的账号类型
     *
     * @param userType
     * @Description:
     *//*
    protected void checkStuUserType(Integer userType) {
        if (userType == null) {
            return;
        }

        enumFieldValueChecker.checkStuUserType(userType);
    }

    *//**
     * 校验企业类型
     *
     * @param characterId
     * @Description:
     *//*
    protected void checkEnterpriseCharacterTypeEnum(Integer characterId) {
        if (characterId == null) {
            return;
        }

        enumFieldValueChecker.checkEnterpriseCharacterTypeEnum(characterId);

    }

    *//**
     * 校验行业id
     *
     * @param industryId
     * @Description:
     *//*
    protected void checkIndustryId(Long industryId) {
        if (industryId == null) {
            return;
        }

        enumFieldValueChecker.checkIndustryId(industryId);

    }

    *//**
     * 校验岗位是否已发布
     *
     * @param jobId
     * @Description:
     *//*
    protected void checkJobPublished(Long jobId) {
        if (jobId == null) {
            return;
        }

        enumFieldValueChecker.checkJobPublished(jobId);

    }

    *//**
     * 校验申请岗位id是否存在
     *
     * @param applyJobId
     * @Description:
     *//*
    protected void checkApplyJobIdExists(Long applyJobId) {
        if (applyJobId == null) {
            return;
        }

        enumFieldValueChecker.checkApplyJobIdExists(applyJobId);
    }

    *//**
     * @param jobId
     * @Description:
     *//*
    protected void checkJobExists(Long jobId) {
        if (jobId == null) {
            return;
        }

        enumFieldValueChecker.checkJobExists(jobId);

    }

    *//**
     * 校验简历是否存在
     *
     * @param resume_id
     * @Description:
     *//*
    protected void checkResumeExists(Long resumeId) {
        if (resumeId == null) {
            return;
        }

        enumFieldValueChecker.checkResumeExists(resumeId);
    }

    *//**
     * 根据岗位id获取对应雇主id
     *
     * @param jobId
     * @return
     * @Description:
     *//*
    protected Long getEntIdByJobId(Long jobId) {
        Assert.notNull(jobId);

        return parttimeJobBeanCache.getEntIdByJobId(jobId);
    }

    *//**
     * 判断岗位是否是当前企业发布的
     *
     * @param jobId
     * @param allowBdOperate
     * @return
     * @Description:
     *//*
    protected void checkJobPublishByCurrentEnterprise(Long jobId, boolean allowBdOperate) {
        if (jobId == null) {
            return;
        }

        final ParttimeJobBean job = parttimeJobBeanCache.getBeanById(jobId);
        if (allowBdOperate) {
            this.checkJobEntOpernatePriviledge(job);
        } else {
            final Long entAccountId = job.getEntAccountId();
            final Long currentAccountId = this.getCurrentAccountId();
            if (ObjectUtils.notEqual(currentAccountId, entAccountId)) {
                String logMsg = "此岗位不属于当前雇主";
                throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), logMsg);
            }
        }
    }

    *//**
     * 根据简历id和岗位id查询申请的岗位id
     *
     * @param resumeId
     * @param jobId
     * @Description:
     *//*
    protected Long getApplyJobIdByResumeIdAndJobId(Long resumeId, Long jobId) {
        return jobIdResumeIdCache.getApplyJobIdByResumeIdAndJobId(resumeId, jobId);
    }

    *//**
     * 解析double字段，并忽略异常
     *
     * @param content
     * @param fieldName
     * @return
     * @Description:
     *//*
    protected Double getDoubleIngoreEx(JSONObject content, String fieldName) {
        try {
            return content.getDouble(fieldName);
        } catch (RuntimeException ex) {
            logger.error("解析" + fieldName + "时抛出异常", ex.getMessage());
            // 忽略异常
            return null;
        }
    }

    protected static int getAge(Date dateOfBirth) {
        int age = 0;
        Calendar born = Calendar.getInstance();
        Calendar now = Calendar.getInstance();
        if (dateOfBirth != null) {
            now.setTime(new Date());
            born.setTime(dateOfBirth);

            if (born.after(now)) {
                return age;
            }
            age = now.get(Calendar.YEAR) - born.get(Calendar.YEAR);
            if (now.get(Calendar.DAY_OF_YEAR) < born.get(Calendar.DAY_OF_YEAR)) {
                age -= 1;
            }
        }
        return age;
    }

    protected static Integer minusDate(Date startTime, Date endTime) {

        Long start = startTime.getTime() - startTime.getTime() % 86400000;
        Long end = endTime.getTime() - endTime.getTime() % 86400000;

        return (int) ((end - start) / 86400000);
    }
    
    protected Long getCdAccountIdByJobId(Long jobId) {
        Assert.notNull(jobId);

        return recruitmentServiceHelper.getCdAccountIdByJobId(jobId);
    }

    *//**
     * 当前请求是否是CD在协助执行
     *
     * @param jobId
     * @return
     * @Description:
     *//*
    protected boolean isCDAssistEntExecute(Long jobId) {
        Assert.notNull(jobId);

        ParttimeJobBean job = parttimeJobBeanCache.getBeanById(jobId);
        if (job == null) {
            String logMsg = "该岗位不存在";
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), logMsg);
        }
        final Long currentAccountId = this.getCurrentAccountId();
        final Long jobEntAccountId = job.getEntAccountId();

        if (currentAccountId.equals(jobEntAccountId)) {
            return false;
        }

        final Long cdAccountId = this.getCdAccountIdByJobId(jobId);
        // 该岗位不存在包招cd前台账号，表示不是cd帮企业处理
        if (cdAccountId == null) {
            return false;
        }
        if (cdAccountId.equals(currentAccountId)) {
            return true;
        }
        final Long currentCdAdminId = this.getAdminIdByAccountId(currentAccountId);
        if (currentCdAdminId == null) {
            // 当前登录账号没有对应的后台cd账号,并且不是当前岗位的雇主，
            String logMsg = "该岗位不属于当前登录用户，无法操作";
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), logMsg);
        }

        // 判断是否是管理该bd的城市经理进行操作
        UserInfoBean userInfoBean = adminUserBeanCache.getUserInfo(currentCdAdminId);
        if (userInfoBean.getUserType() == UserTypeEnum.MARKET_MANAGER.getCode() && userInfoBean.getRank() == UserInfoRankEnum.CITY_MANAGER.getCode()) {
            List<Long> canManageBdIdList = recruitmentServiceHelper.getBdCanManageBdIdList(currentCdAdminId);
            final Long bdAdminId = this.getAdminIdByAccountId(cdAccountId);
            if (canManageBdIdList.contains(bdAdminId)) {
                return true;
            } else {
                String logMsg = "该岗位不属于当前登录bd账户，无法操作";
                throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), logMsg);
            }
        } else {
            String logMsg = "该岗位不属于当前登录账户，无法操作";
            throw new BusinessException(BusinessErrorEnum.ERROR.getCode(), logMsg);
        }
    }

    *//**
     * 获取bd绑定的兼客后台账户id
     *
     * @param accountId
     * @return
     *//*
    protected Long getAdminIdByAccountId(Long accountId) {
        Assert.notNull(accountId);

        return recruitmentServiceHelper.getAdminIdByAccountId(accountId);
    }

    *//**
     * 计算日工资
     *
     * @param job
     * @return
     *//*
    protected Integer computeDaySalary(ParttimeJobBean job) {
        Integer jobDaySalary = 0;
        if (job.getSalaryType().equals(SalaryUnitEnum.MONTH.getCode())
                || job.getSalaryType().equals(SalaryUnitEnum.YUAN_PER_COUNT.getCode())) {
            jobDaySalary = (int) (job.getSalary() * 100);
        } else {
            if (job.getSalaryType() == SalaryUnitEnum.DAY.getCode()) {
                jobDaySalary = (int) (job.getSalary() * 100);
            }
            if (job.getSalaryType() == SalaryUnitEnum.HOUR.getCode()) {


                Long f = 0L;
                Long s = 0L;
                Long t = 0L;


                if (job.getfWorkingTimePeriodStart() != null && job.getfWorkingTimePeriodEnd() != null) {
                    f = CalendarUtil.deleteTimeYMD(job.getfWorkingTimePeriodEnd()).getTime() - CalendarUtil.deleteTimeYMD(job.getfWorkingTimePeriodStart()).getTime();
                }
                if (job.getsWorkingTimePeriodStart() != null && job.getsWorkingTimePeriodEnd() != null) {
                	s = CalendarUtil.deleteTimeYMD(job.getsWorkingTimePeriodEnd()).getTime() - CalendarUtil.deleteTimeYMD(job.getsWorkingTimePeriodStart()).getTime();
                }
                if (job.gettWorkingTimePeriodStart() != null && job.gettWorkingTimePeriodEnd() != null) {
                	t = CalendarUtil.deleteTimeYMD(job.gettWorkingTimePeriodEnd()).getTime() - CalendarUtil.deleteTimeYMD(job.gettWorkingTimePeriodStart()).getTime();
                }
                Long workTime = f + s + t;

                float workHours = workTime / 60000 / 60;
                if (workTime % 3600000 >= 1800000) {
                    workHours += 0.5f;
                }
                jobDaySalary = (int) (job.getSalary() * workHours * 100);
            }
        }
        return jobDaySalary;
    }

    *//**
     * 获取工作时间
     *
     * @param applyJob
     * @return
     *//*
    protected List<Long> getStuWorkTimeArr(ApplyJobBean applyJob) {
        Assert.notNull(applyJob);
        List<Long> stuWorkTimeArr = new LinkedList<Long>();
        if (!StringUtil.isBlank(applyJob.getStuWorkTime())) {
            String[] workTimeArr = applyJob.getStuWorkTime().split(";");
            for (int i = 0; i < workTimeArr.length; i++) {
                stuWorkTimeArr.add(Long.valueOf(workTimeArr[i]));
            }
        }
        return stuWorkTimeArr;
    }

    private void checkPayPassword(String acctencptPassword, Long clientTimeMillSeconds) {
        if (clientTimeMillSeconds != null) {
            userSessionCache.setLong(UserSessionKeyEnum.CLIENT_TIME_MILLSECODS, clientTimeMillSeconds);
        }
        // 判断密码是否正确
        String localPassword = accountMoneyBeanCache.getPlainPassword(getCurrentAccountId());
        String md5Password = Coder.encryptMD5OfRetureStr(localPassword
                + userSessionCache.getString(UserSessionKeyEnum.CHALLENGE));
        if (md5Password == null || !md5Password.equals(acctencptPassword.toUpperCase())) {
            String logMsg = new StringBuilder("密码错误，手机号：[").append(getCurrentPhoneNum()).append("]").toString();
            throw new BusinessException(BusinessErrorEnum.ERROR_PASSWORD.getCode(), "输入的密码有误", logMsg, false);
        }
    }

    protected void checkApplyJobEntOpernatePriviledge(ApplyJobBean applyJob) {
        this.isCDAssistEntExecute(applyJob.getParttimeId());
    }

    protected void checkJobEntOpernatePriviledge(ParttimeJobBean job) {
        this.isCDAssistEntExecute(job.getId());
    }
*/
}
